package com.t2t.top.framework.log;

import ch.qos.logback.classic.pattern.ClassicConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;

/**
 * 格式化日志输出
 */
public class LogExtendConvert extends ClassicConverter {

    @Override
    public String convert(ILoggingEvent event) {
        String value = getString();
        return value;
    }

    private String getString() {
        StringBuffer value = new StringBuffer();
        LogBo bo = LogSessionUtils.get();
        //非空的话，追加流程id，便于查错
        if (bo != null) {
            value.append("[tid_" + bo.getTid() + "_" + bo.getLine() + "]");
        }
        return value.toString();
    }
} 